package org.demo.rmi.server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.rmi.server.RMISocketFactory;

/**
 * 自定义数据端口
 * @author  
 * @date    2010-11-25
 * @file    org.demo.rmi.server.CustomerSocketFactory.java
 */
public class CustomerSocketFactory extends RMISocketFactory{
	// 数据端口
	public static final int data_port = 10990; 
	
	@Override
	public ServerSocket createServerSocket(int port) throws IOException {
		if (port == 0){
			port = data_port;
		}
		return new ServerSocket(port);
	}
	
	@Override
	public Socket createSocket(String host, int port) throws IOException {
		return new Socket(host, port);
	}
}